/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FarmacieDAL;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "VANZARI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Vanzari.findAll", query = "SELECT v FROM Vanzari v"),
    @NamedQuery(name = "Vanzari.findByCantitate", query = "SELECT v FROM Vanzari v WHERE v.cantitate = :cantitate"),
    @NamedQuery(name = "Vanzari.findByPret", query = "SELECT v FROM Vanzari v WHERE v.pret = :pret"),
    @NamedQuery(name = "Vanzari.findByIdVanzare", query = "SELECT v FROM Vanzari v WHERE v.idVanzare = :idVanzare")})
public class Vanzari implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "CANTITATE")
    private BigInteger cantitate;
    @Column(name = "PRET")
    private BigInteger pret;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_VANZARE")
    private Integer idVanzare;
    @OneToMany(mappedBy = "idVanzare")
    private Collection<DetaliiChitanta> detaliiChitantaCollection;
    @JoinColumn(name = "ID_MEDICAMENT", referencedColumnName = "ID_MEDICAMENT")
    @ManyToOne(optional = false)
    private Medicament idMedicament;

    public Vanzari() {
    }

    public Vanzari(Integer idVanzare) {
        this.idVanzare = idVanzare;
    }

    public BigInteger getCantitate() {
        return cantitate;
    }

    public void setCantitate(BigInteger cantitate) {
        this.cantitate = cantitate;
    }

    public BigInteger getPret() {
        return pret;
    }

    public void setPret(BigInteger pret) {
        this.pret = pret;
    }

    public Integer getIdVanzare() {
        return idVanzare;
    }

    public void setIdVanzare(Integer idVanzare) {
        this.idVanzare = idVanzare;
    }

    @XmlTransient
    public Collection<DetaliiChitanta> getDetaliiChitantaCollection() {
        return detaliiChitantaCollection;
    }

    public void setDetaliiChitantaCollection(Collection<DetaliiChitanta> detaliiChitantaCollection) {
        this.detaliiChitantaCollection = detaliiChitantaCollection;
    }

    public Medicament getIdMedicament() {
        return idMedicament;
    }

    public void setIdMedicament(Medicament idMedicament) {
        this.idMedicament = idMedicament;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idVanzare != null ? idVanzare.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vanzari)) {
            return false;
        }
        Vanzari other = (Vanzari) object;
        if ((this.idVanzare == null && other.idVanzare != null) || (this.idVanzare != null && !this.idVanzare.equals(other.idVanzare))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "FarmacieDAL.Vanzari[ idVanzare=" + idVanzare + " ]";
    }
    
}
